package com.atguigu.service.impl;
import java.math.BigDecimal;


import com.atguigu.domain.Product;
import com.atguigu.service.IProductService;
import org.springframework.stereotype.Service;

import java.util.Optional;
import java.util.concurrent.TimeUnit;


@Service
public class ProductServiceImpl implements IProductService {
    @Override
    public Optional<Product> getProductById(String id) {
        Product product = new Product();
        product.setId(id);
        product.setPrice(new BigDecimal("123"));
        product.setProductName("手机");
        product.setNum(10);
//        int a=10/0;
//        try {
//            TimeUnit.SECONDS.sleep(2);
//        } catch (InterruptedException e) {
//            throw new RuntimeException(e);
//        }
        return Optional.of(product);
    }
}
